c 
c Copyright (C) 1993, Silicon Graphics, Inc.
c All Rights Reserved.
c
      PROGRAM MAIN
      IMPLICIT DOUBLE PRECISION(A-H, O-Z)
C 
C---------------------------------------------------------
C 
C       DRIVER PROGRAM FOR INNER PRODUCT ROUTINE
C 
C------------------------------------------------------------ 
C 
C 
      DIMENSION A(800,800),B(800,800),C(800,800)
      REAL*4 T0,ETIME,TARRY(2)
	DOUBLE PRECISION ALPHA,BETA

	character*80 evalue
	integer charcmp

	ALPHA=1.0D0
	BETA = 0.0D0
C 
C 
 300  READ(5,*,END=999) MA,NA,MB,NB,MC,NC,IDUMP
      PRINT *,'MA,NA,MB,NB,MC,NC,IDUMP = ',MA,NA,MB,NB,MC,NC,IDUMP
C 
C 
C       setup jump table
C 
	call readenv('SGI_ISA',evalue,7,length)
	if (length .eq. 0) then
	   print *,'error - set SGI_ISA environment variable'
	   stop
	end if
	if (charcmp(evalue,'mips1') .eq. 0) then
 	    call setmips1()
	else if (charcmp(evalue,'mips2') .eq. 0) then
	    call setmips2()
	end if

C
C
C       GENERATE A,B
C

       DO 100 I = 1, MA 
	DO 100 J=1,NA
 100    A(I,J) = 1.0D0
       DO 200 I = 1, MB 
	DO 200 J=1,NB
 200    B(I,J) = 1.0D0
C       DO 300 I = 1, MC 
C	DO 300 J=1,NC
C 300    C(I,J) = 1.0D0
C
C       INITIALIZE NUMBER OF COUNTS
C
        ICOUNT = 2 * MA * NA * NC * IDUMP
C
C       FIND SYSTEM ID AND # OF HEADS
C
C
C       CALL MATRIX PRODUCT ROUTINE
C 
      T0 = ETIME(TARRY)
	DO III=1,IDUMP
	CALL BLOC_MPY('N','N',MC,NC,MB,ALPHA,A,800,B,800,BETA,C,800,
     +	1)	
	ENDDO
      T0 = ETIME(TARRY) - T0

C

C      OUTPUT RESULTS
C
C      WRITE(6,9) S1,S2,S3,S4,S5,S6,S7
C 9    FORMAT(' ******** THE INNER PRODUCT ARE ',6G15.7/1X,G15.7)
C      IF(IDUMP .GT. 0) CALL MATPRT(MC,NC,C,800,800)
      CTIME = 1.0
      WRITE(6,20) CTIME,T0 
  20  FORMAT(//'* CPU TIME FOR OUTER PRODUCT =',G15.7
     + /'  WALL TIME FOR OUTER PRODUCT =',G15.7)
C
C     CALCULATE MEGAFLOPS
C
      WFLOPS = DFLOAT(ICOUNT)/1.D6/T0
      WRITE(6,31)  WFLOPS
 31   FORMAT(' MEGAFLOPS =',G15.7)
C
      GO TO 300
C
  999 STOP
      END 
